/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.yonsei.iwb.sdt.datastructure;

import com.hp.hpl.jena.rdf.model.Resource;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

/**
 *
 * @author DK
 */
public class TargetInstanceValueInformation extends Hashtable<Integer, Vector<Resource>> {

    public void putTargetInstaceValue(Resource r, int id) {

        if (!this.containsKey(id)) {
            Vector<Resource> rset = new Vector<Resource>();
            rset.add(r);
            this.put(id, rset);
        } else {
            this.get(id).add(r);
        }
    }

    public String getResourceListByClassValueString() {
        String s = new String();

        Enumeration<Integer> keye = this.keys();
        while (keye.hasMoreElements()) {
            int key = keye.nextElement();
            Vector<Resource> rset = this.get(key);
//            double valueInsnum = rset.size();
            s += "<b>Class " + key + " value Instance List </b><br>";
            for (int i = 0; i < rset.size(); i++) {
                String rs = rset.get(i).getLocalName();
                s += rs + "<br>";
            }
        }
        s = "<html><center>" + s + "</center></html>";
        return s;
    }
    
    @Override
    public String toString(){
        String s = new String();

        Enumeration<Integer> keye = this.keys();
        while (keye.hasMoreElements()) {
            int key = keye.nextElement();
            Vector<Resource> rset = this.get(key);
//            double valueInsnum = rset.size();
            s += "Class " + key + " value Instance List : ";
            for (int i = 0; i < rset.size(); i++) {
                String rs = rset.get(i).getLocalName();
                s += rs+", ";
            }            
            s+="\n";
        }
//        s = "<html><center>" + s + "</center></html>";
        return s;
    }

    public int getClassValueSize() {
        return this.keySet().size();
    }
//    public boolean checkEmptyValue(int size){
//        
//        if(this.keySet().size() == size){
//            
//        }
//        
//        return false;
//    }
}
